﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using StudyCompanion.Commons.WebSocket;
using StudyCompanion.Core.Middleware;

namespace StudyCompanion.Core.Extensions;

public static class ApplicationBuilderExtension
{
    public static IApplicationBuilder MapWebSocketManager(this IApplicationBuilder app, PathString path,
        WebSocketHandler handler)
    {
        return app.Map(path, _app => _app.UseMiddleware<WebSocketManagerMiddleware>(handler));
    }
}